package com.small.admin.controller;

import com.small.common.base.BaseController;
import com.small.common.msg.Msg;
import com.small.common.msg.MsgCommon;
import com.small.common.msg.MsgPage;
import com.small.common.msg.UserMsgPage;
import com.small.common.util.val.group.ValAdd;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.small.admin.service.SysUserService;
import com.small.admin.dto.UserPage;
import com.small.admin.entity.SysUser;

/**
 * 作者: guoshun
 * 邮箱: 2855052663@qq.com
 * 时间: 2018-10-26 16:21:00
 * 描述: 系统用户
 */
@RestController
@RequestMapping("sysUser")
public class SysUserController{

    @Autowired
    private SysUserService sysUserService;
    
    @GetMapping(value="list")
    public UserMsgPage<SysUser> page(UserPage userPage){
      return sysUserService.selectByPage(userPage);
    }
    
    @PostMapping(value="add")
    public Msg add(@Validated(ValAdd.class) @RequestBody SysUser sysUser){
        sysUserService.add(sysUser);
        return MsgCommon.SUCCESS;
        
    }
}